from request import Request
from util import logger
import json

# test-other.py中的固定参数
test_other_params = {
    'device_platform': 'webapp',
    'aid': '6383',
    'channel': 'channel_pc_web',
    'publish_video_strategy_type': '2',
    'source': 'channel_pc_web',
    'sec_user_id': 'MS4wLjABAAAAFFSebq0wtofl1v55ak14_sCqEotqFAnjBwz-6ZJ1J9Q',
    'personal_center_strategy': '1',
    'profile_other_record_enable': '1',
    'land_to': '1',
    'update_version_code': '170400',
    'pc_client_type': '1',
    'pc_libra_divert': 'Windows',
    'support_h265': '1',
    'support_dash': '1',
    'cpu_core_num': '12',
    'version_code': '170400',
    'version_name': '17.4.0',
    'cookie_enabled': 'true',
    'screen_width': '2560',
    'screen_height': '1440',
    'browser_language': 'zh-CN',
    'browser_platform': 'Win32',
    'browser_name': 'Edge',
    'browser_version': '138.0.0.0',
    'browser_online': 'true',
    'engine_name': 'Blink',
    'engine_version': '138.0.0.0',
    'os_name': 'Windows',
    'os_version': '10',
    'device_memory': '8',
    'platform': 'PC',
    'downlink': '10',
    'effective_type': '4g',
    'round_trip_time': '100',
    'webid': '7483171167227659830',
    'uifid': '164c22db5016193fd69c8bfb0b166ea3a563c2c88054b8eae8759946ea9753ce075876e6cf3d53a3bcd9946d4bdf98fa6c287a4c1ea3b4af412d09773df5a059c2aac5e18ea48ccf770159719ef7de9dae7f19f2a4df260de78f5da4573d0f6fca7705e137c8254d7aee892e0f69ec5dce475f001eeb7f1c752fa8b4242b3d1d577c033923602bef33c999a6fa40a21aaebb100a2d4922cc0fd7726536ee39d8569199066ea1734a2d059e089c060ddaa090f6c7d01d3605d080168f1f844844',
    'verifyFp': 'verify_md709ed1_hLJwCn79_wgTF_4LHk_9OfY_cGEfYy6KzPVV',
    'fp': 'verify_md709ed1_hLJwCn79_wgTF_4LHk_9OfY_cGEfYy6KzPVV',
    'msToken': 'tajoEgRrE9BGs70xzQ6pnFSpxHHhgXNo8NCzZX9lrj0Br7CEfvdKQ_iel1riKEjxbfhRwBfudRFeMRIZJIAoa0hqbUjgI7Rc1scnTVDkBKtGLfsiCuvAMFUUwKqMkZPsjVpn1-tTEshU2t7NYq04nWRlfx2g_BIort57pq1vkPPenPraqwefP7I=',
    'a_bogus': 'OvsVgtSwmxQbFdFGmCGA9tMUIudMrPWySBTdStOPyNu2Oq0YUuPnkntSboz54i5jg8BzwH37TD0AbxxcTsU0ZHrpqmpkS/4Wo0AII88L2qqmTlhpLNRpCLuNtJHG8QiEY/oyJ1hIlU8PIxC4DprhUQ5Je/TrsYkpQqrRdnUaY9tk60G9FrFKuPbdxXzN5R2-Zf==',
    'x-secsdk-web-expire': '1754127410592',
    'x-secsdk-web-signature': '12bf9723441ac11da4c9052092b0c10b',
}

# 使用Request类生成的参数
cookie_str = 'theme=%22light%22; UIFID_TEMP=164c22db5016193fd69c8bfb0b166ea3a563c2c88054b8eae8759946ea9753ce075876e6cf3d53a3bcd9946d4bdf98fa6c287a4c1ea3b4af412d09773df5a0590f016b2beaddcc7e4ecda75d6b82266917d5d82f230fbc1fabc5073bb8b8a6dd2bfa0da581369eb02e8134a9064ceb06; fpk1=U2FsdGVkX1++EcQ2qTHSTHZ1c4gHBggXGLU1PTiFm1AM7JV5GMwwU+FPkzzo+evxidxXWLAhW58chWysXhxobA==; fpk2=800683566637788f812c9cb58711ba4c; bd_ticket_guard_client_web_domain=2; UIFID=164c22db5016193fd69c8bfb0b166ea3a563c2c88054b8eae8759946ea9753ce075876e6cf3d53a3bcd9946d4bdf98fa6c287a4c1ea3b4af412d09773df5a059c2aac5e18ea48ccf770159719ef7de9dae7f19f2a4df260de78f5da4573d0f6fca7705e137c8254d7aee892e0f69ec5dce475f001eeb7f1c752fa8b4242b3d1d577c033923602bef33c999a6fa40a21aaebb100a2d4922cc0fd7726536ee39d8569199066ea1734a2d059e089c060ddaa090f6c7d01d3605d080168f1f844844; SEARCH_RESULT_LIST_TYPE=%22multi%22; is_staff_user=false; store-region=cn-sd; store-region-src=uid; SelfTabRedDotControl=%5B%5D; xgplayer_device_id=67662969789; xgplayer_user_id=415340770605; live_use_vvc=%22false%22; my_rd=2; dy_swidth=2560; dy_sheight=1440; SearchMultiColumnLandingAbVer=2; enter_pc_once=1; hevc_supported=true; is_dash_user=1; passport_csrf_token=04f062b75f130b6b8fb952821e6f7921; passport_csrf_token_default=04f062b75f130b6b8fb952821e6f7921; __security_mc_1_s_sdk_crypt_sdk=f1a1fec6-4549-b145; s_v_web_id=verify_md709ed1_hLJwCn79_wgTF_4LHk_9OfY_cGEfYy6KzPVV; __security_mc_1_s_sdk_cert_key=be7f8a5c-432c-82da; __druidClientInfo=JTdCJTIyY2xpZW50V2lkdGglMjIlM0EyOTglMkMlMjJjbGllbnRIZWlnaHQlMjIlM0E2OTQlMkMlMjJ3aWR0aCUyMiUzQTI5OCUyQyUyMmhlaWdodCUyMiUzQTY5NCUyQyUyMmRldmljZVBpeGVsUmF0aW8lMjIlM0ExLjUlMkMlMjJ1c2VyQWdlbnQlMjIlM0ElMjJNb3ppbGxhJTJGNS4wJTIwKFdpbmRvd3MlMjBOVCUyMDEwLjAlM0IlMjBXaW42NCUzQiUyMHg2NCklMjBBcHBsZVdlYktpdCUyRjUzNy4zNiUyMChLSFRNTCUyQyUyMGxpa2UlMjBHZWNrbyklMjBDaHJvbWUlMkYxMzguMC4wLjAlMjBTYWZhcmklMkY1MzcuMzYlMjBFZGclMkYxMzguMC4wLjAlMjIlN0Q=; passport_mfa_token=CjbcsSBOC0LsxjIa%2Fri4dQ0Cditl1FpfkXlaCmkmWJAiE8VIzA4U53aVwKIOJvwSaQJhzQO5H40aSgo8AAAAAAAAAAAAAE9JvH7bB927izLqK%2BwU4hIpZ2JTQaBPGCn1D1r9AwWgAhFA8GF15kyT9FkgwjK3hjayEKz29w0Y9rHRbCACIgED6WefFQ%3D%3D; d_ticket=c730cd3ba7cd34308e7ff608e52f9524b3637; passport_auth_status=63f841fbd4f22d54e00e21b16f7662db%2C; passport_auth_status_ss=63f841fbd4f22d54e00e21b16f7662db%2C; _bd_ticket_crypt_doamin=2; __security_server_data_status=1; passport_assist_user=CkEdMj1Iora7sU4liPqujnqHifM1kKAIfAPvN0UDaiNXfKP5IK7kPyRH95Qqr8Kw9ZZjvsy3HCsCNyCkP8mdygt4tBpKCjwAAAAAAAAAAAAAT0ka0yoKQdS7MSQgf8iOrXXJhGaoyfHyoe4wLf5oRvTC1sB0AW8Ursa3ng6mzlASkOgQu_f3DRiJr9ZUIAEiAQONfrQL; n_mh=IVs8xxNG_rrRorlEz3vua016x9GdeOoi1mrL4rxWVV8; sid_guard=b28ac7a15a33426eb2e9256c6b8c3edf%7C1753681532%7C5184000%7CFri%2C+26-Sep-2025+05%3A45%3A32+GMT; uid_tt=5add4cf04bf14d284269d95d3fbd1deb; uid_tt_ss=5add4cf04bf14d284269d95d3fbd1deb; sid_tt=b28ac7a15a33426eb2e9256c6b8c3edf; sessionid=b28ac7a15a33426eb2e9256c6b8c3edf; sessionid_ss=b28ac7a15a33426eb2e9256c6b8c3edf; session_tlb_tag=sttt%7C18%7CsorHoVozQm6y6SVsa4w-3_________-x7Q9l1hbIqmoR1JDYuDSI7WWzmsbPOewif_kDlHl6Y5w%3D; sid_ucp_v1=1.0.0-KDgzMjQyZDlhYmY2ZWI5ZGUzZTQyYThmY2UzN2ZhNzViMTM4NzE1ODEKIQjQwvDJgc3MBBD8nJzEBhjvMSAMMNKohqQGOAVA-wdIBBoCbHEiIGIyOGFjN2ExNWEzMzQyNmViMmU5MjU2YzZiOGMzZWRm; ssid_ucp_v1=1.0.0-KDgzMjQyZDlhYmY2ZWI5ZGUzZTQyYThmY2UzN2ZhNzViMTM4NzE1ODEKIQjQwvDJgc3MBBD8nJzEBhjvMSAMMNKohqQGOAVA-wdIBBoCbHEiIGIyOGFjN2ExNWEzMzQyNmViMmU5MjU2YzZiOGMzZWRm; login_time=1753681534088; __security_mc_1_s_sdk_sign_data_key_web_protect=5ce9e876-41ab-9d07; _bd_ticket_crypt_cookie=ee2856ace8fda6b9410ba78b3a252b3b; DiscoverFeedExposedAd=%7B%7D; __live_version__=%221.1.3.6365%22; live_can_add_dy_2_desktop=%220%22; publish_badge_show_info=%221%2C0%2C0%2C1753970295564%22; vdg_s=1; douyin.com; device_web_cpu_core=12; device_web_memory_size=8; architecture=amd64; strategyABtestKey=%221754098001.038%22; stream_recommend_feed_params=%22%7B%5C%22cookie_enabled%5C%22%3Atrue%2C%5C%22screen_width%5C%22%3A2560%2C%5C%22screen_height%5C%22%3A1440%2C%5C%22browser_online%5C%22%3Atrue%2C%5C%22cpu_core_num%5C%22%3A12%2C%5C%22device_memory%5C%22%3A8%2C%5C%22downlink%5C%22%3A10%2C%5C%22effective_type%5C%22%3A%5C%224g%5C%22%2C%5C%22round_trip_time%5C%22%3A100%7D%22; FOLLOW_RED_POINT_INFO=%221%22; __ac_signature=_02B4Z6wo00f01-jf9BgAAIDD3.swRSBWiRPo..CAAJLDf0; playRecommendGuideTagCount=10; totalRecommendGuideTagCount=10; volume_info=%7B%22isUserMute%22%3Afalse%2C%22isMute%22%3Afalse%2C%22volume%22%3A1%7D; biz_trace_id=228ad773; WallpaperGuide=%7B%22showTime%22%3A0%2C%22closeTime%22%3A0%2C%22showCount%22%3A0%2C%22cursor1%22%3A30%2C%22cursor2%22%3A8%7D; xg_device_score=7.606596267646973; passport_fe_beating_status=true; sdk_source_info=7e276470716a68645a606960273f276364697660272927676c715a6d6069756077273f276364697660272927666d776a68605a607d71606b766c6a6b5a7666776c7571273f275e58272927666a6b766a69605a696c6061273f27636469766027292762696a6764695a7364776c6467696076273f275e582729277672715a646971273f2763646976602729277f6b5a666475273f2763646976602729276d6a6e5a6b6a716c273f2763646976602729276c6b6f5a7f6367273f27636469766027292771273f2731363436333532373431303234272927676c715a75776a716a666a69273f2763646976602778; bit_env=KkIODXjd2UFQcf98YwC0cJqxyKfAnOgB4YYvsR0V4sXX4Mxu2zbmwQxQW_fIOuc7v7UyK1ccIRiq_5YZMejAvqA-zd3pUENcSKZUAM4LdEMMTdM2rJR25GbWIZqSzYCrE8nOZfGx4b5kYj-zHiVEWj7dZetTQ__d3zE4LhdCJLEqV8RikriSYGStcdH5btKKj8fZDWo5Pp9Np4YRUaSrP2FI3_EsdiElTK9s4mb8b9uVzYdvJe-Yt_dbp_ekrgXHEJwuqcMmMvTJhraL31LlMuIWm_bVp-a_qCGtYCKUypPHsqYD9UKtCZMuc6fOBYbCLBSP6UHJNZWj--zubMHmn1hR_joynD87Zo6i5JuwaiYKF_dG_8fQDOUkV136w4j-KHCHUZBt1wo_W_QQFHBJcds0vsxVwKloSWOTps0EScyjZb08TRPyvj46ckuGGPL_vQekQ4gFtbo_BTfjdRvK-RLauP9PxmTxd9OL0i20koet2qiaiZ2ecWuliABKyCvA7LXszvSN8weL8nE8exdBKZRMt4cmHCTQidQ3c3wd_Vg%3D; gulu_source_res=eyJwX2luIjoiNzU0M2ZjOGQ1M2I0ODllM2QzNDA1NDBmYmViY2VhOTQ5YjdkNmE0NmQyY2RiODQzN2RiNDY4OTdiNDkzN2RlZiJ9; passport_auth_mix_state=tg74r5u09j11x9scfdkd5sp27urg3q7g89k3en9pxp7cpn7z; __ac_nonce=0688ddada007cef747eeb; stream_player_status_params=%22%7B%5C%22is_auto_play%5C%22%3A0%2C%5C%22is_full_screen%5C%22%3A0%2C%5C%22is_full_webscreen%5C%22%3A1%2C%5C%22is_mute%5C%22%3A0%2C%5C%22is_speed%5C%22%3A1%2C%5C%22is_visible%5C%22%3A0%7D%22; FOLLOW_LIVE_POINT_INFO=%22MS4wLjABAAAAXZI6LYdc99Uzm9OtYfEeIF2AvXiGAkEP_8P-R6Ln587GkxSJPLgBOv0v3FSphRWO%2F1754150400000%2F0%2F0%2F1754127681880%22; FOLLOW_NUMBER_YELLOW_POINT_INFO=%22MS4wLjABAAAAXZI6LYdc99Uzm9OtYfEeIF2AvXiGAkEP_8P-R6Ln587GkxSJPLgBOv0v3FSphRWO%2F1754150400000%2F0%2F1754127081880%2F0%22; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCS1FINEs3enpXa0ZYOFNoMWI2SXZJUERWdWhkYkJJbWxheFlrMnNlTWFHbG5xZnBjT0pTM0k2YTFab01LTEV5YjdJcjdhSGd5ZFJaTXhoaDF5RjhxbGM9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoyfQ%3D%3D; ttwid=1%7CLtBGbJGrDlk1gaWMIOttG7PbVzA30P5KakjWIh78fbM%7C1754127085%7C67f3798f8aeabbfc34bcb9e14bb10d432871cb5143d99aeb4c48c9c785df901e; odin_tt=51c9fd2771fecfd574b55029744d24bda74619172543ec9e5bb87adc257b45f12058ef22c8a899560cb8d794cc46ae2367d42bd925d76256865f45dc91a307e9; IsDouyinActive=true; home_can_add_dy_2_desktop=%220%22; msToken=tajoEgRrE9BGs70xzQ6pnFSpxHHhgXNo8NCzZX9lrj0Br7CEfvdKQ_iel1riKEjxbfhRwBfudRFeMRIZJIAoa0hqbUjgI7Rc1scnTVDkBKtGLfsiCuvAMFUUwKqMkZPsjVpn1-tTEshU2t7NYq04nWRlfx2g_BIort57pq1vkPPenPraqwefP7I='

request = Request(cookie_str)

# 基础参数
base_params = {
    'sec_user_id': 'MS4wLjABAAAAFFSebq0wtofl1v55ak14_sCqEotqFAnjBwz-6ZJ1J9Q',
    'personal_center_strategy': '1',
    'profile_other_record_enable': '1',
    'land_to': '1',
    'source': 'channel_pc_web',
    'support_h265': '1',
    'support_dash': '1'
}

# 使用Request类处理参数
request_params = request.get_params(base_params.copy())

logger.info("=== test-other.py 参数 ===")
for key, value in sorted(test_other_params.items()):
    logger.info(f"{key}: {value}")

logger.info("\n=== request.py 生成的参数 ===")
for key, value in sorted(request_params.items()):
    logger.info(f"{key}: {value}")

logger.info("\n=== 参数差异对比 ===")
all_keys = set(test_other_params.keys()) | set(request_params.keys())
for key in sorted(all_keys):
    test_val = test_other_params.get(key, 'MISSING')
    req_val = request_params.get(key, 'MISSING')
    if test_val != req_val:
        logger.warning(f"差异 {key}: test-other='{test_val}' vs request='{req_val}'")
    else:
        logger.info(f"相同 {key}: {test_val}")